package com.book.service.impl;

import com.book.entity.Dict;
import com.book.format.Result;
import com.book.format.ResultUtil;
import com.book.service.DictService;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Mikey on 2017/6/11.
 */
@Service
public class DictServiceImpl implements DictService {

    private String DICTMAPPER = "com.book.mapper.DictMapper";

    @Resource
    private SqlSessionTemplate sqlSessionTemplate;

    public Result selectDictByDpid(String d_pid){
        Map map = new HashMap();
        map.put("d_pid",d_pid);
        List<Dict> dicts = sqlSessionTemplate.selectList(DICTMAPPER+".selectDictByDpid",map);
        return ResultUtil.success(dicts);
    }
}
